package com.b511.swpu.cementbackend.util.convert;

import com.b511.swpu.cementbackend.exception.CementException;
import com.b511.swpu.cementbackend.util.enumeration.Code;
import com.b511.swpu.cementbackend.util.convert.lengthAndWidth.LengthAndWidthContext;
import com.b511.swpu.cementbackend.util.convert.volume.VolumeContext;

public class TypeFactory {

    // 静态工厂
    public static Context getConvertFactory(String typeName) {
        switch (typeName) {
            case "1":
                return new LengthAndWidthContext();
            case "2":
                return new VolumeContext();
            default:
                throw new CementException(Code.FAIL);
        }
    }
}
